<template>
	<view class="TutorTab">
		<view @tap="tapSwtichTab(item,index)" :class="atciveIndex===index ? 'TutorTab_item activeClass':'TutorTab_item'"
			v-for="(item, index) in  list" :key="index">
			<text class="text">{{item}}</text>
			<image v-if="atciveIndex===index " class="imagesBt" src="../../../static/user/bg_line.png"></image>
			<image v-if="atciveIndex===index " :class="atciveIndex ?'activeClassImgRight':'activeClassImgLeft'"
				src="../../../static/user/bg_xuanzhongbg1.jpg"></image>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'TutorTab',
		emits: ['clickSwtichTab'],
		props: {
			//栏目数据列表
			list: {
				type: Array,
				default: ['最新动态','评价列表']
			},
			//选中的项目index
			atciveIndex: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {

			};
		},
		methods: {
			tapSwtichTab(item, index) {
				this.$emit("clickSwtichTab", {
					item,
					index
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	.TutorTab {
		display: flex;
		justify-content: space-between;  
		padding: 0 0  20rpx 0;
		background-color: #f6f6f6;

		.TutorTab_item { 
			color: #6c6c6c;
			width: 45%;
			padding: 20rpx 0;
			font-size: 16px;
			font-weight: bold;
			position: relative;
			z-index: 10;
			/* 设置较高的 z-index */
			text-align: center;
			/* 文字居中 */
		}

		.activeClass {
			position: relative;
			/* 设置相对定位，以便伪元素定位 */
			font-size: 16px;
			font-weight: bold;
			color: #333;
			z-index: 1;
			// background-color: #e0f9f8;
			text-align: center;
			/* 文字居中 */
		}

		.text {
			position: relative;
			z-index: 100;
		}

		.activeClassImgLeft {
			width: 690rpx;
			height: 200rpx;
			position: absolute;
			left: 0;
			top: 0;
			transform: scaleX(-1);
			z-index: 1;
		}

		.activeClassImgRight {
			width: 690rpx;
			height: 200rpx;
			position: absolute;
			right: 0;
			top: 0;
			z-index: 1;
		}

		.imagesBt {
			position: absolute;
			z-index: 2;
			/* 绝对定位 */
			top: 70rpx;
			/* 将半圆放置在文本下方 */
			left: 50%;
			/* 使半圆居中 */
			transform: translateX(-50%);
			/* 完全居中 */
			width: 40rpx;
			/* 半圆的宽度 */
			height: 16rpx;
			/* 半圆的高度 */
		}
	}
</style>